#include "../os_common.h"
//*************************************************
//Added by WangJS 2005.9.14
//*************************************************
VOID ByteSwap(UCHAR* B1, UCHAR* B2)
{
	UCHAR Temp;
	Temp=*B1;
	*B1=*B2;
	*B2=Temp;
}
//***************************************************
//Added by WangJS 2005.9.14
//***************************************************
PVOID CompareMin(PVOID C1, PVOID C2, UINT CompSize)
{
	PVOID Equal=0;
	UCHAR* S1=(UCHAR*)C1;
	UCHAR* S2=(UCHAR*)C2;
	UINT i;

	for( i=0; i<CompSize; i++ )
	{
		Equal= ( S1[i] != S2[i] ) ? ( S1[i] < S2[i] ? (PVOID)S1 : (PVOID)S2 ) : 0;

		if(Equal)
		  return Equal;
	}

	if( !Equal )
		return C1;
	else
		return Equal;
}

PVOID CompareMax(PVOID C1, PVOID C2, UINT CompSize)
{
	PVOID Equal=0;
	UCHAR* S1=(UCHAR*)C1;
	UCHAR* S2=(UCHAR*)C2;
	UINT i;

	for( i=0; i<CompSize; i++ )
	{
		Equal= ( S1[i] != S2[i] ) ? ( S1[i] > S2[i] ? (PVOID)S1 : (PVOID)S2 ) : 0;

		if(Equal)
		  return Equal;
	}

	if( !Equal )
		return C1;
	else
		return Equal;
}


